Skip to content

fix: add always() to run-codex job to handle skipped dependency#703

Merged
stranske merged 1 commit intomainfrom
fix/run-codex-always-condition
Jan 9, 2026
Merged

fix: add always() to run-codex job to handle skipped dependency#703
stranske merged 1 commit intomainfrom
fix/run-codex-always-condition

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Jan 9, 2026

Problem

The run-codex job in agents-keepalive-loop.yml depends on resolve-trivial-conflicts, which is skipped when action is 'run' (rather than 'conflict').

In GitHub Actions, when a job you depend on is skipped, your job is also skipped without evaluating its if condition—unless you use always().

Root Cause

run-codex:
  needs:
    - evaluate
    - preflight
    - mark-running
    - resolve-trivial-conflicts  # <-- This is skipped when action='run'
  if: |
    needs.evaluate.outputs.agent_type == 'codex' &&
    (needs.resolve-trivial-conflicts.result == 'skipped' || ...)  # Never evaluated!

Even though the condition checks for result == 'skipped', GitHub Actions never reaches the if evaluation because the dependency was skipped.

Evidence

From run 20857158812:

Job Conclusion
Evaluate keepalive loop success
Verify secrets available success
Mark agent running success
Auto-resolve PR-specific files skipped
Keepalive next task (Codex) skipped ← Bug!

The Codex job was skipped even though:

  • agent_type = 'codex'
  • resolve-trivial-conflicts.result = 'skipped' ✓ (which should allow run)

Solution

Add always() and explicitly check that upstream jobs succeeded:

if: |
  always() &&
  needs.evaluate.result == 'success' &&
  needs.preflight.result == 'success' &&
  needs.mark-running.result == 'success' &&
  needs.evaluate.outputs.agent_type == 'codex' &&
  (needs.resolve-trivial-conflicts.result == 'skipped' ||
   needs.resolve-trivial-conflicts.outputs.remaining_conflicts != '0')

Affected PRs

This will unblock:

Testing

After merging this PR and syncing to consumer repos, trigger keepalive on any stuck PR and verify the Codex job runs.

The run-codex job depends on resolve-trivial-conflicts, which is skipped
when action is 'run' (rather than 'conflict'). Without always() in the
condition, GitHub Actions skips dependent jobs without evaluating their
if conditions.

This fix:
1. Adds always() so the condition is actually evaluated
2. Explicitly checks that upstream jobs (evaluate, preflight, mark-running)
   succeeded, since always() runs even on failure
3. Keeps the existing logic for agent_type and conflict resolution

This resolves the issue where run-codex was being skipped even when:
- agent_type = 'codex'
- resolve-trivial-conflicts.result = 'skipped' (which should allow run)

Fixes stuck PRs: stranske/Portable-Alpha-Extension-Model#1067, #1066,
stranske/Trend_Model_Project#4309
Copilot AI review requested due to automatic review settings January 9, 2026 16:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

Automated Status Summary

Head SHA: 1434d2c
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / Enforce agents workflow protections
Required: core tests (3.11): ⏳ pending, core tests (3.12): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 92.21%
Baseline 85.00%
Delta +7.21%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/workflow_health_check.py 62.6% 28
scripts/classify_test_failures.py 62.9% 37
scripts/ledger_validate.py 65.3% 63
scripts/mypy_return_autofix.py 82.6% 11
scripts/ledger_migrate_base.py 85.5% 13
scripts/fix_cosmetic_aggregate.py 92.3% 1
scripts/coverage_history_append.py 92.8% 2
scripts/workflow_validator.py 93.3% 4
scripts/update_autofix_expectations.py 93.9% 1
scripts/pr_metrics_tracker.py 95.7% 3
scripts/generate_residual_trend.py 96.6% 1
scripts/build_autofix_pr_comment.py 97.0% 2
scripts/aggregate_agent_metrics.py 97.2% 0
scripts/fix_numpy_asserts.py 98.1% 0
scripts/sync_test_dependencies.py 98.3% 1

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a GitHub Actions workflow bug where the run-codex job was being skipped when its dependency resolve-trivial-conflicts was skipped, even though the job's condition explicitly checked for that scenario. By adding always() and explicit success checks for upstream jobs, the workflow now correctly evaluates the condition and runs the Codex job when appropriate.

Key changes:

  • Added always() guard to force evaluation of the run-codex job's if condition
  • Added explicit success checks for upstream dependencies (evaluate, preflight, mark-running)
  • Preserved existing logic for determining when Codex should run based on conflict resolution state

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

🤖 Keepalive Loop Status

PR #703 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Disposition skipped (transient)
Gate success
Tasks 0/6 complete
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

@stranske stranske merged commit 3bfcacf into main Jan 9, 2026
43 of 44 checks passed
@stranske stranske deleted the fix/run-codex-always-condition branch January 9, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants